home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Bonus / Database / mysql-max-3.23.55.sit / mysql-max-3.23.55-apple-darwi.1 / mysql-test / t / rpl_mystery22.test < prev    next >
Encoding:
Text File  |  2003-01-21  |  1.2 KB  |  44 lines  |  [TEXT/ttxt]

  1. # test case to make slave thread get ahead by 22 bytes
  2.  
  3. source include/master-slave.inc;
  4. connection master;
  5. # first, cause a duplicate key problem on the slave
  6. create table t1(n int auto_increment primary key);
  7. save_master_pos;
  8. connection slave;
  9. sync_with_master;
  10. insert into t1 values (2);
  11. connection master;
  12. insert into t1 values(NULL);
  13. insert into t1 values(NULL);
  14. save_master_pos;
  15. connection slave;
  16. sleep 1; # there is no way around this sleep - we have to wait until
  17. # the slave tries to run the query, fails and aborts slave thread
  18. delete from t1 where n = 2;
  19. slave start;
  20. sync_with_master;
  21. #now the buggy slave would be confused on the offset but it can replicate
  22. #in order to make it break, we need to stop/start the slave one more time
  23. slave stop;
  24. connection master;
  25. # to be able to really confuse the slave, we need some non-auto-increment
  26. # events in the log
  27. create table t2(n int);
  28. drop table t2;
  29. insert into t1 values(NULL);
  30. save_master_pos;
  31. connection slave;
  32. slave start;
  33. #now the truth comes out - if the slave is buggy, it will never sync because
  34. #the slave thread is not able to read events
  35. sync_with_master;
  36. select * from t1;
  37. #clean up
  38. connection master;
  39. drop table t1;
  40. save_master_pos;
  41. connection slave;
  42. sync_with_master;
  43.  
  44.